home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cpptutor.arc / SUPERVSR.CPP < prev    next >
Text File  |  1991-04-28  |  2KB  |  79 lines

  1.                                        // Chapter 11 - Program 4
  2. #include "supervsr.hpp"
  3. #include "iostream.h"
  4. #include "stdio.h"
  5. #include "string.h"
  6.  
  7. // In all cases, init_data assigns values to the class variables and
  8. //  display outputs the values to the monitor for inspection.
  9.  
  10. void
  11. supervisor::init_data(char in_name[], int in_salary, char in_title[])
  12. {
  13.    strcpy(name,in_name);
  14.    salary = in_salary;
  15.    strcpy(title, in_title);
  16. }
  17.  
  18.  
  19.  
  20.  
  21. void
  22. supervisor::display(void)
  23. {
  24.    cout << "Supervisor --> " << name << "'s salary is " << salary <<
  25.                                  " and is the " << title << ".\n\n";
  26. }
  27.  
  28.  
  29.  
  30.  
  31. void
  32. programmer::init_data(char in_name[], int in_salary, char in_title[],
  33.                   char in_language[])
  34. {
  35.    strcpy(name,in_name);
  36.    salary = in_salary;
  37.    strcpy(title, in_title);
  38.    strcpy(language, in_language);
  39. }
  40.  
  41.  
  42.  
  43.  
  44. void
  45. programmer::display(void)
  46. {
  47.    cout << "Programmer --> " << name << "'s salary is " << salary <<
  48.                                         " and is " << title << ".\n";
  49.    cout << "               " << name << "'s specialty is " << 
  50.                                                  language << ".\n\n";
  51. }
  52.  
  53.  
  54.  
  55.  
  56. void
  57. secretary::init_data(char in_name[], int in_salary, 
  58.                              char in_shorthand, char in_typing_speed)
  59. {
  60.    strcpy(name,in_name);
  61.    salary = in_salary;
  62.    shorthand = in_shorthand;
  63.    typing_speed = in_typing_speed;
  64. }
  65.  
  66.  
  67.  
  68.  
  69. void
  70. secretary::display(void)
  71. {
  72.    cout << "Secretary ---> " << name << "'s salary is " << salary <<
  73.                                                                  ".\n";
  74.    cout << "               " << name << " types " << typing_speed <<
  75.               " per minute and can ";
  76.    if (!shorthand) cout << "not ";
  77.    cout << "take shorthand.\n\n";
  78. }
  79.